package net.alan.modules.repository;

import net.alan.modules.bean.DataStat;
import net.alan.modules.bean.Weekly;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Author 李岩飞
 * Email eliyanfei@126.com
 * 2017/11/22
 */
public interface WeeklyRepository extends JpaRepository<Weekly, Integer> {
    List<Weekly> findByProjectIdAndWeekOrderByIdDesc(Integer projectId, Integer week);

    @Query(value = "select user_id as l1,count(distinct week) as l2 from weekly  where project_id = ?1 and month=?2 group by user_id", nativeQuery = true)
    public List<Object[]> statList(Integer projectId,int month);
}
